From: Wei Wang Date: Tue, 6 Oct 2015 15:37:48 +0000 (+0200) Subject: x86/cpufreq: add a new driver interface, setpolicy() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2443 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7b82467fe7d2a2c8a7d1280414ff2c996160a3fb;p=xen.git x86/cpufreq: add a new driver interface, setpolicy() In order to better support future Intel processors, intel_pstate changes to use percentage values to tune P-states. The setpolicy driver interface is used to configure the intel_pstate internal policy. The __cpufreq_set_policy needs to be intercepted to use the setpolicy driver if it exists. Signed-off-by: Wei Wang Reviewed-by: Andrew Cooper --- diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c index 519f862182..53879fe8dd 100644 --- a/xen/drivers/cpufreq/utility.c +++ b/xen/drivers/cpufreq/utility.c @@ -456,6 +456,9 @@ int __cpufreq_set_policy(struct cpufreq_policy *data, data->min = policy->min; data->max = policy->max; + data->limits = policy->limits; + if (cpufreq_driver->setpolicy) + return cpufreq_driver->setpolicy(data); if (policy->governor != data->governor) { /* save old, working values */ diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h index f96c3e4ccf..1ec04ca2bd 100644 --- a/xen/include/acpi/cpufreq/cpufreq.h +++ b/xen/include/acpi/cpufreq/cpufreq.h @@ -41,6 +41,18 @@ struct cpufreq_cpuinfo { unsigned int transition_latency; /* in 10^(-9) s = nanoseconds */ }; +struct perf_limits { + bool_t no_turbo; + bool_t turbo_disabled; + uint32_t turbo_pct; + uint32_t max_perf_pct; /* max performance in percentage */ + uint32_t min_perf_pct; /* min performance in percentage */ + uint32_t max_perf; + uint32_t min_perf; + uint32_t max_policy_pct; + uint32_t min_policy_pct; +}; + struct cpufreq_policy { cpumask_var_t cpus; /* affected CPUs */ unsigned int shared_type; /* ANY or ALL affected CPUs @@ -52,6 +64,7 @@ struct cpufreq_policy { unsigned int max; /* in kHz */ unsigned int cur; /* in kHz, only needed if cpufreq * governors are used */ + struct perf_limits limits; struct cpufreq_governor *governor; bool_t resume; /* flag for cpufreq 1st run @@ -145,6 +158,7 @@ struct cpufreq_driver { char name[CPUFREQ_NAME_LEN]; int (*init)(struct cpufreq_policy *policy); int (*verify)(struct cpufreq_policy *policy); + int (*setpolicy)(struct cpufreq_policy *policy); int (*update)(int cpuid, struct cpufreq_policy *policy); int (*target)(struct cpufreq_policy *policy, unsigned int target_freq,